﻿@model CheckUpdateResult

@{
	ViewBag.Title = T("Admin.CheckUpdate");
}

<div class="section-header">
	<div class="title">
		<i class="fa fa-level-up-alt"></i>
		@ViewBag.Title
	</div>
</div>

<div class="check-update-page" style="max-width: 1000px">
	@if (!Model.UpdateAvailable)
	{
		<dl>
			<dt>@T("Admin.CheckUpdate.YourVersion")</dt>
			<dd>@Model.CurrentVersion</dd>
		</dl>
		<div class="alert alert-info">
			@T("Admin.CheckUpdate.IsUpToDate")
		</div>
	}
	else
	{
		<h3 class="text-danger">@T("Admin.CheckUpdate.UpdateAvailable")!</h3>
		<dl>
			<dt>@T("Admin.CheckUpdate.YourVersion")</dt>
			<dd>@Model.CurrentVersion</dd>
			<dt>@T("Admin.CheckUpdate.CurrentVersion")</dt>
			<dd class="text-danger">@Model.Version</dd>
			<dt>@T("Common.Date")</dt>
			<dd>@Model.ReleaseDateUtc.ToShortDateString().ReplaceNativeDigits()</dd>
		</dl>

		if (Model.AutoUpdatePossible && Model.AutoUpdatePackageUrl.IsWebUrl())
		{
			<div class="alert alert-success mt-0">
				<h4>@T("Admin.CheckUpdate.AutoUpdatePossible")</h4>
				@Html.Raw(T("Admin.CheckUpdate.AutoUpdatePossibleInfo"))
				<p class="mt-4">
					<a class="btn btn-primary" href='@Url.Action("InstallUpdate", new { packageUrl = Model.AutoUpdatePackageUrl })' onclick='return confirm(@T("Admin.Common.AskToProceed").JsText);'>
						<i class="fa fa-level-up-alt"></i>
						<span>@T("Admin.CheckUpdate.UpdateNow")</span>
					</a>
				</p>
			</div>
		}

		<div class="admin-config-group">
			<div class="title">@T("Admin.CheckUpdate.ReleaseNotes")</div>
			<div>@Html.Raw(Model.ReleaseNotes)</div>
		</div>

		<div class="mt-5">
			<a class="btn btn-primary" href='@Model.InfoUrl' target="UpdateInfoWnd">
				<span>@T("Common.MoreInfo")</span>
			</a>

			@if (Model.DownloadUrl.HasValue())
			{
				<a class="btn btn-secondary ml-2" href='@Model.DownloadUrl'>
					<i class="fa fa-download"></i>
					<span>@T("Common.Download")</span>
				</a>
			}

			<a class="btn btn-link" href='@Url.Action("CheckUpdateSuppress", new { myVersion = Model.CurrentVersion, newVersion = Model.Version })'>
				<span>@T("Admin.CheckUpdate.DontNotifyAnymore")</span>
			</a>
		</div>
	}
</div>

